package com.supor.aiot.food.api;

import com.android.baseconfig.base.BaseApiResult;
import com.android.baseconfig.base.BaseRetrofit;
import com.android.baseconfig.base.DataApiResult;
import com.supor.aiot.food.bean.AddBasketBean;
import com.supor.aiot.food.bean.BindDeviceBean;
import com.supor.aiot.food.bean.ChefDetailBean;
import com.supor.aiot.food.bean.ChildListBean;
import com.supor.aiot.food.bean.RecipeDeviceBean;
import com.supor.aiot.food.bean.RecipeHotBean;
import com.supor.aiot.food.bean.RecipeStoreBean;
import com.supor.aiot.food.bean.RecipeTopicBean;
import com.supor.aiot.food.bean.RequstChefBean;
import com.supor.aiot.food.bean.TopicDetailBean;

import java.util.List;

import io.reactivex.rxjava3.core.Observable;

/**
 * ---------------------------------------------------------------- <br>
 * Copyright (C) 2014-2020, by het, Shenzhen, All rights reserved.  <br>
 * ---------------------------------------------------------------- <br>
 * <p>
 * 描述: UserImpl <br>
 * 作者: lei <br>
 * 日期: 2020/11/7 <br>
 */
public class SearchFoodImpl extends BaseRetrofit<SearchFoodService> implements SearchFoodService {
    private static SearchFoodImpl instance;

    public static SearchFoodImpl getInstance() {
        if (instance == null) {
            instance = new SearchFoodImpl();
        }
        return instance;
    }

    /**
     * 查询用户信息接口
     *
     * @return BaseApiResult<String>
     */
    public Observable<BaseApiResult<String>> getUserInfo(String userid) {
        return api.getUserInfo(userid).compose(this.applySchedulers());
    }

    /**
     * 查询二级食谱接口
     *
     * @return BaseApiResult<String>
     */
    public Observable<BaseApiResult<DataApiResult<List<RecipeHotBean>>>> checkRecipeClassify(String id, int page, int limit) {
        return api.checkRecipeClassify(id, page, limit).compose(this.applySchedulers());
    }

    /**
     * 查询所有分类接口
     *
     * @return BaseApiResult<String>
     */
    @Override
    public Observable<BaseApiResult<DataApiResult<List<ChildListBean>>>> getAllClassify(String parentId,int limit) {
        return api.getAllClassify(parentId,limit).compose(this.applySchedulers());
    }

    /**
     * 二级分类所有接口
     *
     * @param parentId
     * @return
     */
    @Override
    public Observable<BaseApiResult<DataApiResult<List<ChildListBean>>>> getSecondaryAllClassify(String parentId) {
        return api.getSecondaryAllClassify(parentId).compose(this.applySchedulers());
    }

    /**
     * 查询热门推荐接口
     *
     * @return BaseApiResult<String>
     */
    @Override
    public Observable<BaseApiResult<DataApiResult<List<RecipeHotBean>>>> getHotRecipe(String hot, int page, int limit) {
        return api.getHotRecipe(hot, page, limit).compose(this.applySchedulers());
    }

    /**
     * 寻味页热门食谱
     *
     * @param modelTypeId
     * @param page
     * @param limit
     * @return
     */
    @Override
    public Observable<BaseApiResult<DataApiResult<List<RecipeHotBean>>>> getHotRecipeFood(String modelTypeId, int page, int limit) {
        return api.getHotRecipeFood(modelTypeId, page, limit).compose(this.applySchedulers());
    }

    /**
     * 寻味页热门食谱
     *
     * @param productModel
     * @param page
     * @param limit
     * @return
     */
    @Override
    public Observable<BaseApiResult<DataApiResult<List<RecipeHotBean>>>> getHotRecipeFoodNew(String productModel, int page, int limit) {
        return api.getHotRecipeFoodNew(productModel, page, limit).compose(this.applySchedulers());
    }

    /**
     * 查询最新推荐接口
     *
     * @return BaseApiResult<String>
     */
    @Override
    public Observable<BaseApiResult<DataApiResult<List<RecipeHotBean>>>> getNewRecipe(String state, int page, int limit) {
        return api.getNewRecipe(state, page, limit).compose(this.applySchedulers());
    }

    /**
     * 查询最新推荐接口新
     *
     * @return BaseApiResult<String>
     */
    @Override
    public Observable<BaseApiResult<DataApiResult<List<RecipeHotBean>>>> getRecipeNew(String productModel, String type, int page, int limit) {
        return api.getRecipeNew(productModel, type, page, limit).compose(this.applySchedulers());
    }


    /**
     * 设备小类食谱查询
     *
     * @param productModel
     * @param page
     * @param limit
     * @return
     */
    @Override
    public Observable<BaseApiResult<DataApiResult<List<RecipeHotBean>>>> getNewRecipeByProduct(String productModel, int page, int limit) {
        return api.getNewRecipeByProduct(productModel, page, limit).compose(this.applySchedulers());
    }

    /**
     * 模糊查询接口
     *
     * @param recipeName recipeName
     * @return Observable<BaseApiResult<DataApiResult<List<RecipeHotBean>>>>
     */
    @Override
    public Observable<BaseApiResult<DataApiResult<List<RecipeHotBean>>>> searchRecipe(String productModel, String recipeName, int page, int limit) {
        return api.searchRecipe(productModel, recipeName, page, limit).compose(this.applySchedulers());
    }

    /**
     * 大家都在做
     *
     * @param page
     * @param limit
     * @return
     */
    @Override
    public Observable<BaseApiResult<DataApiResult<List<RecipeHotBean>>>> getPopularRecipe(int page, int limit) {
        return api.getPopularRecipe(page, limit).compose(this.applySchedulers());
    }

    /**
     * 美味上新
     *
     * @param page
     * @param limit
     * @return
     */
    @Override
    public Observable<BaseApiResult<DataApiResult<List<RecipeHotBean>>>> getNewestRecipe(int page, int limit) {
        return api.getNewestRecipe(page, limit).compose(this.applySchedulers());
    }

    /**
     * 添加食谱到菜篮子
     *
     * @param basketBean
     * @return
     */
    @Override
    public Observable<BaseApiResult<String>> addIntoBasket(AddBasketBean basketBean) {
        return api.addIntoBasket(basketBean).compose(this.applySchedulers());
    }

    /**
     * 收藏食谱
     *
     * @param storeBean
     * @return
     */
    @Override
    public Observable<BaseApiResult<String>> recipeStore(RecipeStoreBean storeBean) {
        return api.recipeStore(storeBean).compose(this.applySchedulers());
    }

    /**
     * 取消收藏
     *
     * @param favorateId
     * @return
     */
    @Override
    public Observable<BaseApiResult<String>> cancleRecipeStore(int favorateId) {
        return api.cancleRecipeStore(favorateId).compose(this.applySchedulers());
    }

    /**
     * 查询美食专辑接口
     *
     * @return
     */
    @Override
    public Observable<BaseApiResult<DataApiResult<List<RecipeTopicBean>>>> getFoodRecords(String remark, int limit) {
        return api.getFoodRecords(remark, limit).compose(this.applySchedulers());
    }

    /**
     * 查询视频食谱列表
     *
     * @param page
     * @param limit
     * @param recipeType
     * @param recipeStatus
     * @return
     */
    @Override
    public Observable<BaseApiResult<DataApiResult<List<RecipeHotBean>>>> getVedioRecips(int page, int limit, String recipeType, String recipeStatus) {
        return api.getVedioRecips(page, limit, recipeType, recipeStatus).compose(this.applySchedulers());
    }

    /**
     * 主厨页详情
     *
     * @param chefId
     * @return
     */
    @Override
    public Observable<BaseApiResult<DataApiResult<List<ChefDetailBean>>>> getChefDetail(String chefId) {
        return api.getChefDetail(chefId).compose(this.applySchedulers());
    }

    /**
     * 主厨列表
     *
     * @param page
     * @param limit
     * @return
     */
    @Override
    public Observable<BaseApiResult<DataApiResult<List<ChefDetailBean>>>> getChefList(int page, int limit) {
        return api.getChefList(page, limit).compose(this.applySchedulers());
    }

    /**
     * 美食专辑详情
     *
     * @param dataId
     * @return
     */
    @Override
    public Observable<BaseApiResult<DataApiResult<List<TopicDetailBean>>>> getTopicDetail(String dataId) {
        return api.getTopicDetail(dataId).compose(this.applySchedulers());
    }

    /**
     * 获取美食专辑食谱
     *
     * @param cuisineId
     * @return
     */
    @Override
    public Observable<BaseApiResult<DataApiResult<List<RecipeHotBean>>>> getTopicRecipe(String cuisineId, int page, int limit) {
        return api.getTopicRecipe(cuisineId, page, limit).compose(this.applySchedulers());
    }

    /**
     * 主厨上新
     *
     * @param chefId
     * @param type
     * @return
     */
    @Override
    public Observable<BaseApiResult<DataApiResult<List<RecipeHotBean>>>> getCookerNew(String chefId, String type, int page, int limit) {
        return api.getCookerNew(chefId, type, page, limit).compose(this.applySchedulers());
    }

    /**
     * 拿手好菜
     *
     * @param chefId
     * @param type
     * @return
     */
    @Override
    public Observable<BaseApiResult<DataApiResult<List<RecipeHotBean>>>> getCookerGood(String chefId, String type, int page, int limit) {
        return api.getCookerGood(chefId, type, page, limit).compose(this.applySchedulers());
    }

    /**
     * 求更新
     *
     * @param chefBean
     * @return
     */
    @Override
    public Observable<BaseApiResult<String>> requestUpdate(RequstChefBean chefBean) {
        return api.requestUpdate(chefBean).compose(this.applySchedulers());
    }

    /**
     * 获取设备
     *
     * @param limit
     * @return
     */
    @Override
    public Observable<BaseApiResult<DataApiResult<List<RecipeDeviceBean>>>> getRecipeDevice(int limit) {
        return api.getRecipeDevice(limit).compose(this.applySchedulers());
    }

    /**
     * 待绑定设备列表
     *
     * @return
     */
    @Override
    public Observable<BaseApiResult<List<BindDeviceBean>>> getUnbindDevice() {
        return api.getUnbindDevice().compose(this.applySchedulers());
    }

    @Override
    public Observable<BaseApiResult<DataApiResult<List<RecipeHotBean>>>> getNewRecomond() {
        return api.getNewRecomond().compose(this.applySchedulers());
    }

}
